<include file="Public/header" />
<title>管理员列表</title>
</head>
<body>
<div class="pd-20">

	<div class="cl pd-5 bg-1 bk-gray mt-20"> 
		<form class="formleft" name="" id="" action="__URL__/get_warehousebound/" method="get">
			<input class="input-text" style="width:200px" type="hidden" value="<{$_GET['warehouse_code']}>" placeholder="仓库编码" name="warehouse_code" >
			<input class="input-text" style="width:200px" type="hidden" value="<{$_GET['manua_id']}>" placeholder="账册编号" name="manua_id" >
			<input class="input-text" style="width:200px" type="text" value="<{$_GET['goods_no']}>" placeholder="商品编码" name="goods_no" >
			<input class="input-text" style="width:200px" type="text" value="<{$_GET['goods_name']}>" placeholder="商品名称" name="goods_name" >
			<input class="input-text" style="width:200px" type="text" value="<{$_GET['bar_code']}>" placeholder="条形码" name="bar_code" >
			
			<input  type="hidden" value="<{$_GET['merchant_code']}>"  name="merchant_code" >
			<input  type="hidden" value="<{$_GET['order_id']}>"  name="order_id" >
			
			<button type="submit" class="btn btn-success"><i class="icon-plus"></i> 查询</button>
			
			<button type="button" class="btn btn-primary confirm_add" ><i class="icon-plus"></i> 确定添加</button>
		</form>
		<span class="r">共有数据：<strong><{$total}></strong> 条</span> 
    </div>
	
	<table class="table table-border table-bordered table-bg">
		<thead>
			<tr>
				<th scope="col" colspan="20">商品库存列表</th>
			</tr>
			<tr class="text-c">
				<th width="25"><input type="checkbox" name="" value=""></th>
				<th>序号</th>
				<th width="">货主编码</th>
				<th width="">商品编码</th>
				<th width="">账册编号</th>
				<th width="">商品名称</th>
				<th width="">条形码</th>
				<th width="">单位</th>
				<!-- <th width="">总数量</th> -->
				<!-- <th width="">库存数量</th> -->
			</tr>
		</thead>
		<tbody>
			<volist name="list" id="vo">
			<tr class="text-c">
				<td><input  class="uids" type="checkbox" attr_goods_no="<{$vo.goods_no}>" attr_manua_id="<{$vo.manua_id}>" attr_goods_name="<{$vo.goods_name}>" attr_bar_code="<{$vo.bar_code}>" attr_merchant_code="<{$vo.merchant_code}>" value="<{$vo.id}>" name="ids[]"></td>
				<td><{$i}></td>
				<td><{$vo.merchant_code}></td>
				<td><{$vo.goods_no}></td>
				<td><{$vo.manua_id}></td>
				<td><{$vo.goods_name}></td>
				<td><{$vo.bar_code}></td>
				<td><{$vo.unit1}></td>
				<!-- <td><{$vo.amount}>(<{$vo.unit1}>)</td> -->
				<!-- <td><{$vo.storage_amount}>(<{$vo.unit1}>)</td> -->
			</tr>
			</volist>			
		</tbody>
	</table>
	<div class="page mt" style="text-align:right"><{$page}></div>
	
</div>
<script>
	$('.confirm_add').click(function(){

		var option = $(".uids");
		var checked_counts=0;
		var check_val = [];
		
		var goods_no_str= [];
		var manua_id_str= [];
		var goods_name_str= [];
		var bar_code_str= [];
		var merchant_code_str=[];
		for(var i=0;i<option.length;i++){
			if(option[i].checked){
				checked_counts++;
				check_val.push(option[i].value);
				manua_id_str.push(option.eq(i).attr('attr_manua_id'));
				goods_name_str.push(option.eq(i).attr('attr_goods_name'));
				goods_no_str.push(option.eq(i).attr('attr_goods_no'));
				bar_code_str.push(option.eq(i).attr('attr_bar_code'));
				merchant_code_str.push(option.eq(i).attr('attr_merchant_code'));
			}
		}
		if(checked_counts==0){
			layer.msg('至少选中一个');
			return false;
		}else{
			$.ajax({
                type: 'POST',
                data: {order_id:<{:I('order_id')}>,goods_no:goods_no_str,manua_id:manua_id_str,goods_name:goods_name_str,bar_code:bar_code_str,merchant_code:merchant_code_str},
                url: "<{:U('confirm_add')}>",
                success:function(data){
                    ajaxobj=eval("("+data+")");
                    layer.msg(ajaxobj.data,{time:1500},function(){
                        parent.window.location.reload();
                        return false;
                    });
                }
            })
		}
	})
</script>
<include file="Public/footer" />
<include file="Public/footer_js" />
</body>
</html>